package com.gitee.wsl.struct.grammar.ast.render.provider

import com.gitee.wsl.struct.grammar.ast.node.ASTNode
import com.gitee.wsl.struct.grammar.ast.node.acceptChildren
import com.gitee.wsl.struct.grammar.ast.visitor.Visitor


abstract class OpenCloseGeneratingProvider<V: Visitor> : GeneratingProvider<V> {

    abstract fun openTag(visitor: V, text: String, node: ASTNode)

    abstract fun closeTag(visitor: V, text: String, node: ASTNode)

    override fun processNode(visitor: V, text: String, node: ASTNode) {
        openTag(visitor, text, node)
        node.acceptChildren(visitor)
        closeTag(visitor, text, node)
    }
}